<!--
 * @Description: 修改微信
 * @Author: liu (1427179517@qq.com)
 * @Date: 2023-05-05 15:16:08
 * @LastEditors: liu (1427179517@qq.com)
 * @LastEditTime: 2023-05-05 15:29:30
 * @FilePath: \jiekuan-app\src\subPages\other\contactInformation.vue
-->
<template>
	<div class="page">
		<div class="page-header">
			<u-navbar title="修改微信" :background="nav_background" title-color="#fff" back-icon-color="#fff" :height="60"
				:border-bottom="false"></u-navbar>
		</div>
		<div class="page-content">
			<div class="u-m-l-10">新微信号</div>
			<div class="u-m-t-22 u-flex wechat">
				<image src="../../static/images/information_pencil.png" class="icon u-m-r-20" alt="" />
				<u-input v-model="wechat" placeholder="请填写微信号" />
			</div>
			<!-- <div class="u-m-t-30 u-m-b-20 u-m-l-10">微信二维码</div> -->
			<!-- <uploadView
        uploadText=""
        ref="upload"
        moduleName="upload"
        :maxCount="1"
        multiple
        :fileList="albumList"
        @onChange="handleUploadChange"
        @onPreview="handleUploadPreview"
        @onRemove="handleUploadRemove"
        class="uploadViewId negative-m-1"
        :width="200"
        :height="200"
      >
      </uploadView> -->
		</div>
		<div class="page-footer">
			<div class="btn_box">
				<button class="btn" @click="modifywechat">申请修改</button>
			</div>
		</div>
	</div>
</template>

<script>
	import uploadView from '@/components/yl-uploadView'
	export default {
		name: 'ContactInformation', // 页面名称
		components: {
			uploadView
		}, // 挂载组件
		props: {}, // 组件传值
		data() {
			return {
				nav_background: {
					background: 'transparent'
				},
				wechat: '', // 微信号
			}
		},
		computed: {}, // 计算机属性 类似与data概念
		watch: {}, // 监控data中数据变化
		created() {}, // 生命周期-创建完成(可以访问当前this实例)
		mounted() {}, // 生命周期-挂载完成(可以访问DOM元素)
		methods: {
			/**
			 * @author: yiling (315800015@qq.com)
			 * @description: 全屏预览图片时触发
			 * @param {String} url 为当前选中的图片地址
			 * @param {Array} lists 目前组件内的所有图片数组，index为通过props传递的index参数
			 * @param {Number} name 为通过props传递的index参数(1.6.1加入)
			 * @return {*}
			 * @Date: 2021-04-17 11:36:57
			 */
			handleUploadPreview(options) {
				uni.setStorageSync('uploadRefresh', true)
			},
			/**
			 * @author: yiling (315800015@qq.com)
			 * @description: 移除图片时触发
			 * @param {Number} index 索引
			 * @param {Array} lists 完整数据
			 * @param {Number} name 通过props传递的index参数
			 * @return {*}
			 * @Date: 2021-04-18 13:09:47
			 */
			handleUploadRemove(options) {
				const {
					index,
					lists,
					name,
					moduleName
				} = options
				console.log('onRemove', options)
				// this.$set(this.form, 'image', str)
			},
			/**
			 * @author: yilingsj（315800015@qq.com）
			 * @description: 上传后触发
			 * @param {type}
			 * @return:
			 * @Date: 2020-07-20 10:43:06
			 */
			handleUploadChange(options) {
				console.log(options, '引用后上传结束')
				const {
					res,
					index,
					lists,
					moduleName
				} = options
				this.albumList.push(options.lists[0].response.data[0].frontUrl)
			},
			modifywechat:function(){
				var that = this;
				var wechat = that.wechat;
				this.$u.api.PostUpdateInfo({
					wechatAccount:wechat
				}).then((res) => {
					this.$u.toast(res.data)
					console.log(res);
					setTimeout(function(){
						uni.navigateBack({
							delta:1
						})
					},1500)
				})
			}
		}, // 挂载一些方法
		onLoad(options) {
			this.$u.api.info().then((res) => {
				this.wechat = res.data.wechatAccount;
			})
		}, // 生命周期回调—监听页面加载
		onShow() {}, // 生命周期回调—监听页面显示
		onReady() {}, // 生命周期回调—监听页面初次渲染完成
		onHide() {}, // 生命周期回调—监听页面隐藏
		onUnload() {}, // 生命周期回调—监听页面卸载
	}
</script>

<style lang="scss" scoped>
	.page {
		background-image: url('http://minio.tianhong.mobi/mall/xiaoq/home_bg.png');
		width: 100%;
		background-size: cover;
		background-repeat: no-repeat;
	}

	.page-content {
		padding: 20rpx 45rpx;
		font-size: 31rpx;
		font-family: Microsoft YaHei UI;
		font-weight: 400;
		color: #ffffff;
	}

	.wechat {
		padding: 0 20rpx;
		height: 70rpx;
		background: #ffffff;
		border-radius: 5rpx;
	}

	.icon {
		width: 27rpx;
		height: 30rpx;
	}

	.btn_box {
		padding: 0 195rpx 120rpx;
	}

	.btn {
		width: 360rpx;
		height: 90rpx;
		background: #fcc307;
		border-radius: 45rpx;
		font-size: 33rpx;
		font-family: Microsoft YaHei UI;
		font-weight: 400;
		color: #ffffff;
		line-height: 90rpx;
	}
</style>
